//
//  CercaApp.swift
//  Cerca
//
//  Created by Adolfo Vera Blasco on 24/06/2020.
// modified by hujiangshui at 31/8/2020

import SwiftUI

@main
struct NearbyApp: App {
    var body: some Scene {
        WindowGroup {
            if NearbyViewModel.nearbySessionAvailable
            {
                NearbyView()
                JSLog.logUxDebug("debug infor, end nearby view")
            }
            else
            {
                ErrorView()
            }
        }
    }
}


import Foundation
class JSLog{
    private init(){}
    private static var isDebug = true;
    
    //业务流程日志 business flow
    static func logBfDebug<T>(_ message: T,file: String = #file,method: String = #function,line: Int = #line){
        if(isDebug){
            print("[Debug] [文件:\((file as NSString).lastPathComponent):\(line)] [方法:\(method)] \n\(message)")
        }
    }
    
    //跟界面相关日志 UI UX
    static func logUxDebug<T>(_ message: T,file: String = #file,method: String = #function,line: Int = #line)-> EmptyView{
        if(isDebug){
            print("[Debug] [文件:\((file as NSString).lastPathComponent):\(line)] [方法:\(method)] \n\(message)")
        }
        return EmptyView()
    }
}
